package com.zyg.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class indexController {

    @RequestMapping("/toindex")
    public String toindex(){
        return "index";
    }

    @RequestMapping("/toindex_v1")
    public String toindex_v1(){
        return "index_v1";
    }
    //  @SaCheckLogin

    @RequestMapping("/getData")
    @ResponseBody
    public String getData(){
        List<EchartsData> data = userService.getDeptIndexData();
        Map<String, Object> map = new HashMap<>();
        if (data != null && data.size() > 0){
            map.put("name",data.stream().map(e -> e.getName()).toList());
            map.put("value",data.stream().map(e -> e.getValue()).toList());
        }
        return JSON.toJSONString(map);
    }
}
}
